package com.example.ccjml;


import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.ccj.b.c.ui.install.SwitchCheckBoxControl;

import java.util.List;

/**
 * 放置图表设置标签Recycler的Adapter
 * 2023年1月7日17:41:48
 */
public class TestRecyclerAdapter extends RecyclerView.Adapter<TestRecyclerAdapter.ViewHolder>{
    private final List<String> switchCheckBoxControls;

    public TestRecyclerAdapter(List<String> switchCheckBoxControls){
        this.switchCheckBoxControls = switchCheckBoxControls;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder(LayoutInflater.from(parent.getContext()).
                inflate(R.layout.adapter_test111, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        holder.text.setText(switchCheckBoxControls.get(position));
    }

    @Override
    public int getItemCount() {
        return switchCheckBoxControls.size();
    }


    @Override
    public int getItemViewType(int position) {
        return position;
    }

    //
    public static class ViewHolder extends RecyclerView.ViewHolder{
        TextView text;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            text = itemView.findViewById(R.id.adapter_test111_text);
        }
    }



}
